package com.basker.pisces.core.meta.row;

import com.basker.pisces.core.RowContract;
import com.basker.pisces.core.enums.DataObjectState;
import com.basker.pisces.core.meta.AbstractDataObjectMeta;
import com.basker.pisces.core.meta.IDataField;
import com.basker.pisces.core.meta.IField;

public class RowContractMeta extends AbstractDataObjectMeta {

    private boolean flatReferenceFields = false;

    @Override
    public final Object createDataObject() {
        return new RowContract(this);
    }

    @Override
    public final Class<?> getDataObjectClass() {
        return RowContract.class;
    }

    @Override
    public IField getField(String name) {
        IField field = super.getField(name);
        if (field != null) {
            return field;
        }

        return null;
    }

    @Override
    public Object getOldValue(Object dataObject, IDataField dataField) {
        return null;
    }

    @Override
    public final DataObjectState getState(Object dataObject) {
        return DataObjectState.UnChanged;
    }

    @Override
    public final boolean isChanged(Object dataObject, IDataField dataField) {
        return false;
    }

    public boolean isFlatReferenceFields() {
        return flatReferenceFields;
    }

    @Override
    public final boolean isFromDB(Object dataObject) {
        return true;
    }

    @Override
    public final boolean isFromDB(Object dataObject, String subTableName) {
        return true;
    }

    public void setFlatReferenceFields(boolean flatReferenceFields) {
        this.flatReferenceFields = flatReferenceFields;
    }

    @Override
    public final void setFromDB(Object dataObject) {

    }

    @Override
    public final void setFromDB(Object dataObject, String subTableName) {

    }

    @Override
    public final void setState(Object dataObject, DataObjectState state) {

    }

}
